package com.lipy.dubboproduct.controller;

import com.lipy.dubbocommon.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Context;

@RestController
@RequestMapping("/demo")
public class DemoController {
    @Autowired
    DemoService demoService;

    @GetMapping("beat")
    public Object beat(@Context HttpServletRequest request){
        System.out.println("uri:"+request.getRequestURI()
            + "sessionid:"+ request.getRequestedSessionId());
        return "ok";
    }

    @GetMapping("test")
    public Object test(){
        String s = demoService.get();
        demoService.process();
        return s;
    }
}
